home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 1999 November / Macworld (1999-11).dmg / Updaters / WhiteCap 3.0.4 / WhiteCap Source.sit / WhiteCap Source / Common / General Tools / Headers / Messager.h < prev    next >
Text File  |  1999-07-13  |  848b  |  45 lines

  1.  
  2. #ifndef _MESSAGER_
  3. #define _MESSAGER_
  4.  
  5.  
  6. #include "XPtrList.h"
  7.  
  8.  
  9.  
  10.  
  11. class Messager {
  12.  
  13.     private:
  14.         
  15.         XPtrList                        mListeners;
  16.         bool                            mIsListening;
  17.         bool                            mAllowBroadcasting;
  18.         
  19.         static XPtrList                    sAllMessagers;
  20.         
  21.         
  22.     public:    
  23.                                         Messager();
  24.                                         ~Messager();
  25.                                         
  26.         void                            StartListening();
  27.         void                            StopListening();
  28.         bool                            IsListening()                                  { return mIsListening; }
  29.         
  30.         void                            SetAllowBroadcasting( bool inAllowed );
  31.         
  32.         //    Post:    Returns true if message was handled.
  33.         virtual bool                    ListenToMsg( long inMessage, long inArgs[] );
  34.         
  35.         void                            AddListener( Messager* inListener );
  36.         void                            CopyListeners( Messager* inSource ); 
  37.         void                            BroadcastMessage( long inMsg, long inArgs[] );
  38.         
  39.         static void                        BroadcastGlobalMessage( long inMessage, long inArgs[] );
  40.  
  41. };
  42.  
  43. #endif
  44.  
  45.